classdef test_static_policy1 < experiment
    
    properties
    end
    
    methods
        function plan=test_plan(obj)            
            plan=...
                [1, 1, 18
                12, 2, 1
                22, 8, 1
                60, 2, 3
                110, 3, 2
                160, 4, 3
                210, 5, 3
                260, 6, 3
                310, 7, 4
                360, 8, 3
                410, 9, 4
                460, 10, 3
                510,11, 5];
        end

        
        function test2(obj)
            obj.system_=system_base();
            system=obj.system_;
            rt_target=2.41;
            experiment_duration=4*4; %23*60
            policy_duration = 4*4;
            workload = system.initialize(experiment_duration);
            s=static_policy(@obj.test_plan);
            res = system.run_plan(system, policy_duration,...
                @(t)s.staticly_configured_policy(t));
            %%% m=obj.build_model( system.past_inst(), system.past_util())
            %%% res=obj.plan(system,experiment_duration-training_duration, @(t) obj.mpcPolicy(m,t));    % sqr = @(x) x.^2;
            
            tot_fired_inst  = sum(system.fired_inst,1);
            disp(strcat('tot_fired_inst:',num2str(tot_fired_inst)));
            tot_cost=system.inst_cost(tot_fired_inst );
            disp(strcat('tot_cost:',num2str(tot_cost)));
            disp('system.fired_inst are ...');
            for i=1:size(system.fired_t,1)
                disp(strcat(num2str(system.fired_t(i)),'-->', num2str(system.fired_inst(i,:))));
            end
            obj.plot_all(workload,rt_target); 
        end
        
    end %methods
    
end

